package com.neusoft.demo.mapper;


import com.neusoft.demo.pojo.Bumen;
import com.neusoft.demo.pojo.Foods;
import com.neusoft.demo.pojo.Yuangong;
import org.apache.ibatis.annotations.*;

@Mapper
public interface FoodsMapper {
    @Select("select * from foods where businessId=#{bid}")
    public java.util.List<Foods> findFoods(int bid);
    @Insert("insert into foods(foodName,foodExplain,foodImg,foodPrice,businessId,remarks) " +
            "values(#{foodName},#{foodExplain},#{foodImg},#{foodPrice},#{businessId},#{remarks})")
    public  int addFoods(Foods foods);
    @Update("update foods set foodName=#{foodName},foodExplain=#{foodExplain},foodImg=#{foodImg}," +
            "foodPrice=#{foodPrice},businessId=#{businessId},remarks=#{remarks} where foodId=#{foodId} ")
    public  int updateFood(Foods foods);
    @Delete("delete from foods where foodId=#{foodId}")
    public  int delFoods(int foodId);
    @Select("<script> select * from foods <where>" +
            "<if test=\"foodName!=null and foodName!=''\"> foodName like concat('%',#{foodName},'%')</if>" +
            "<if test=\"beginSal!=null and beginSal!=0 \"> and  foodPrice>=#{beginSal} </if>" +
            "<if test=\"endSal!=null and endSal!=0 \"> and  foodPrice&lt;=#{endSal} </if> " +
            "<if test=\"businessId>0 \"> and businessId=#{businessId} </if> " +
            "</where> </script>")
    public java.util.List<Foods> Search(String foodName,int beginSal,int endSal,int businessId);


    @Select("select * from foods order by foodId desc")
    public  java.util.List<Foods> findFoodsById();
}
